﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using InnovTech.Persistence;
using NHibernate.Util;

namespace NHibernate.MsSqlCe
{
    public class NHMsSqlCeVirtualEnvironment : NHVirtualEnvironmentBase<INHMsSqlCeDbInfo>
    {

        protected NHMsSqlCeVirtualEnvironment() : base() { }

        public NHMsSqlCeVirtualEnvironment(ISessionFactoryBuilder<INHMsSqlCeDbInfo> builder)
            : base(builder)
        {
        }

        protected override void Cleanup(INHMsSqlCeDbInfo databaseInfo)
        {
            if (File.Exists(databaseInfo.DatabasePath))
                File.Delete(databaseInfo.DatabasePath);
        }


        protected override NHDatabaseGeneratorBase<INHMsSqlCeDbInfo> CreateDatabaseGenerator(ISessionFactoryBuilder<INHMsSqlCeDbInfo> builder)
        {
            return new NHMsSqlCeGenerator(builder);
        }
    }
}
